<?php

namespace app\index\controller;

use app\index\model\TableModel;
use think\Controller;
use think\Request;

class TableController extends Controller
{
    public function index()
    {
        // echo 111;die;
        $data = model('TableModel') ->lists();
        return view('table/index',[
            'data' => $data
        ]);
    }

    public function sure()
    {
        $data = model('TableModel') ->sure();

        if($data === false){
            echo "<script> alert('抱歉哦, 系统繁忙哦, 请重试啦~');history.go(-1); </script>";die;
        }elseif($data === "haven't table"){;
            echo "<script> alert('很抱歉哟~您要的桌位已被预定啦');history.go(-1); </script>";
        }else{
            echo "<script> alert('您已预定成功啦, 请记得准时来就餐哦~');history.go(-1); </script>";
        }
    }
}